package svgundoredo;

/**
 * This is the delete command
 */
import svgedit.svg.SVGElement;
import svgedit.svg.SVGGroup;

public class DeleteElementCommand extends AbstractCommand
{
    private SVGGroup parent;
    private SVGElement child;
    
    /**
     * The construct take the parent group and the selected element to be delete
     * 
     * @param parent
     *            the group or root element
     * @param child
     *            the select element to be delete
     */
    public DeleteElementCommand(SVGGroup parent, SVGElement child)
    {
        this.parent = parent;
        this.child = child;
    }
    
    @Override
    public void execute()
    {
        // TODO Auto-generated method stub
        parent.removeChild(child);
    }
    
    @Override
    public void undo()
    {
        // TODO Auto-generated method stub
        parent.appendChild(child);
    }
    
}
